const HtmlWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
    entry: {
        index: ['./src/js/index.js', './src/scss/index.scss'],
        about: ['./src/js/about.js', './src/scss/about.scss'],
        product: ['./src/js/product.js', './src/scss/product.scss'],
        productlist: ['./src/js/productlist.js', './src/scss/productlist.scss'],
        productshow: ['./src/js/productshow.js', './src/scss/productshow.scss'],
        appointment: ['./src/js/appointment.js', './src/scss/appointment.scss'],
        news: ['./src/js/news.js', './src/scss/news.scss'],
        service: ['./src/js/service.js', './src/scss/service.scss'],
        contact: ['./src/js/contact.js', './src/scss/contact.scss'],
    },
    module: {
        rules: [{
                test: /\.html$/i,
                loader: "html-loader",
            },
            {
                test: /\.(sc|sa|c)ss$/i,
                use: [
                    MiniCssExtractPlugin.loader,
                    'css-loader',
                    'sass-loader',
                ],
            },
        ],
    },

    plugins: [
        new HtmlWebpackPlugin({
            template: "./src/html/index.html",
            filename: "index.html",
            chunks: ["index"]
        }),
        new HtmlWebpackPlugin({
            template: "./src/html/about.html",
            filename: "about.html",
            chunks: ["about"]
        }),
        new HtmlWebpackPlugin({
            template: "./src/html/product.html",
            filename: "product.html",
            chunks: ["product"]
        }),
        new HtmlWebpackPlugin({
            template: "./src/html/productlist.html",
            filename: "productlist.html",
            chunks: ["productlist"]
        }),
        new HtmlWebpackPlugin({
            template: "./src/html/productshow.html",
            filename: "productshow.html",
            chunks: ["productshow"]
        }),
        new HtmlWebpackPlugin({
            template: "./src/html/appointment.html",
            filename: "appointment.html",
            chunks: ["appointment"]
        }),
        new HtmlWebpackPlugin({
            template: "./src/html/news.html",
            filename: "news.html",
            chunks: ["news"]
        }),
        new HtmlWebpackPlugin({
            template: "./src/html/service.html",
            filename: "service.html",
            chunks: ["service"]
        }),
        new HtmlWebpackPlugin({
            template: "./src/html/contact.html",
            filename: "contact.html",
            chunks: ["contact"]
        }),
        new MiniCssExtractPlugin()
    ]
}